package de.g18.scavengerhunt;

import android.app.Activity;
import de.g18.scavengerhunt.types.Session;
import de.g18.scavengerhunt.types.User;

/**
 * This application context stores app wide information
 */
public class AppApplicationContext {

    private static User     user                  = null;

    private static Session  session               = null;

    private static Thread   receivePositionThread = null;

    private static Thread   sendPositionThread    = null;

    private static Activity currentActivity       = null;

    /**
     * Set the current activity.
     * 
     * @param currentActivity
     */
    public static void setActivity(Activity activity) {
        currentActivity = activity;
    }

    /**
     * Get the current activity.
     * 
     * @return currentActivity
     */
    public static Activity getCurrentActivity() {
        return currentActivity;
    }

    /**
     * Sets the thread to receive positions from webservice.
     * 
     * @param receivePositionThread
     */
    public static void setReceivePositionThread(Thread receivePositionThread) {
        AppApplicationContext.receivePositionThread = receivePositionThread;
    }

    /**
     * Get the thread to receive positions from webservice.
     * 
     * @return Thread
     */
    public static Thread getReceivePositionThread() {
        return receivePositionThread;
    }

    /**
     * Sets the thread to send the current position to the webservice.
     * 
     * @param sendPositionThread
     */
    public static void setSendPositionThread(Thread sendPositionThread) {
        AppApplicationContext.sendPositionThread = sendPositionThread;
    }

    /**
     * Get the thread to send the current position to the webservice.
     * 
     * @return Thread
     */
    public static Thread getSendPositionThread() {
        return sendPositionThread;
    }

    /**
     * @return the user
     */
    public static User getUser() {
        return user;
    }

    /**
     * @param user the user to set
     */
    public static void setUser(User user) {
        AppApplicationContext.user = user;
    }

    /**
     * @return the session
     */
    public static Session getSession() {
        return session;
    }

    /**
     * @param session the session to set
     */
    public static void setSession(Session session) {
        AppApplicationContext.session = session;
    }
}